function Article_list() {
    var _this = this;
    var page;
    _this.obj = null;
    _this.page_size = 10;

    // init
    _this.init = function(_page) {
        page = _page;
        _this.initEvent();
        _this.initTable();
    };

    _this.initTable = function() {
        var list_url = appPath + "/article/list";
        page.init("select_article_form", list_url, "select_article_list", "select_article_page", 1, _this.page_size);
        page.goPage(1);
        page.list = function(dataList){
            _this.obj = dataList;
            if(dataList == null){
                return;
            }
            var len = dataList.length;
            var inner = "", item;
            var href = "";
            // 组装数据
            for(var i=0; i< len; i++) {
                item = dataList[i];
                href = appPath + "/article/" + item.id;
                inner += '<tr >';
                inner += '<td width="50">' + (i+1) + '</td>';
                inner += '<td  width="100">'+ item['title'] + '</td>';
                inner += '<td width="100"><a target="_blank" href=\"" + href + "\" class="a a-info">详情</a> ';
                inner += '</tr>';
            }
            return inner;
        }

    };
    _this.initEvent = function () {
        //搜索
        $("#article_search").click(function () {
            _this.search();
        });

       //全部
        $("#article_all").click(function () {
            _this.all();
        });
    };

    //搜索
    _this.search=function(){
      $("#title").val($.trim($("#title").val()));
        _this.initTable();
    };
    //全部
    _this.all = function() {
        $("#title").val("");
        _this.initTable();
    };
}

var article_list = new Article_list();

